home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Essentials / MPW IIGS Interfaces / CIIGSIncludes / StdIO.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-04-01  |  2.5 KB  |  84 lines  |  [TEXT/MPS ]

  1. /*
  2.  *  stdio.h -- Standard C I/O Package
  3.  *  Modified for use with IIGS
  4.  *
  5.  *  Copyright American Telephone & Telegraph
  6.  *  Used with permission, Apple Computer Inc.
  7.  *  Copyrignt Apple Computer Inc. 1985-1987
  8.  *  All rights reserved.
  9.  */
  10.  
  11. #ifndef __STDIO__
  12. #define __STDIO__
  13.  
  14. #define _NFILE    20
  15. #define BUFSIZ  1024            /* default file buffer size */
  16. #define _LBFSIZ  100            /* Line buffer size */
  17.  
  18. typedef struct {
  19.     int             _cnt;
  20.     unsigned char   *_ptr;
  21.     unsigned char   *_base;
  22.     unsigned char   *_end;
  23.     unsigned int    _size;
  24.     unsigned int    _flag;
  25.     unsigned int    _file;
  26. } FILE;
  27.  
  28. /*
  29.  * 07-Sep-85, Hartwell:
  30.  *      _IOSYNC will synchronize input and output fp's, such that
  31.  *              a read() for an input fp with this bit set will first
  32.  *              fflush() all output fp's which have the _IOSYNC bit set.
  33.  *      _IOLBF simply declares that a fflush() occurs when a \n is written.
  34.  */
  35. #define _IOFBF      0           /* Pseudo-flag, default buffering style */
  36. #define _IOREAD     (1<<0)      /* Current mode is for reading */
  37. #define _IOWRT      (1<<1)      /* Current mode is for writing */
  38. #define _IONBF      (1<<2)      /* no buffering */
  39. #define _IOMYBUF    (1<<3)      /* buffer was allocated by stdio */
  40. #define _IOEOF      (1<<4)
  41. #define _IOERR      (1<<5)
  42. #define _IOLBF      (1<<6)      /* fflush(iop) when a \n is written */
  43. #define _IORW       (1<<7)      /* Enable read/write access */
  44. #define _IOSYNC     (1<<8)      /* Input triggers fflush() to output fp's */
  45.  
  46. #ifndef NULL
  47. #define NULL        0L
  48. #endif
  49. #ifndef EOF
  50. #define EOF         (-1)
  51. #endif
  52.  
  53. #define stdin       (&_iob[0])
  54. #define stdout      (&_iob[1])
  55. #define stderr      (&_iob[2])
  56.  
  57. /*
  58.  * Hartwell: new structure components are
  59.  * backwards-compatible with other stdio modules.
  60.  */
  61. #define _bufend(p)  (p)->_end
  62. #define _bufsiz(p)  (p)->_size
  63.  
  64. #ifndef lint
  65. #define getc(p)     (--(p)->_cnt >= 0 ? (int) *(p)->_ptr++ : _filbuf(p))
  66. #define putc(x, p)  (--(p)->_cnt >= 0 ? \
  67.                         ((int) (*(p)->_ptr++ = (unsigned char) (x))) : \
  68.                         _flsbuf((unsigned char) (x), (p)))
  69. #define getchar()   getc(stdin)
  70. #define putchar(x)  putc((x), stdout)
  71. #define clearerr(p) ((void) ((p)->_flag &= ~(_IOERR | _IOEOF)))
  72. #define feof(p)     ((p)->_flag & _IOEOF)
  73. #define ferror(p)   ((p)->_flag & _IOERR)
  74. #define fileno(p)   (p)->_file
  75. #endif lint
  76.  
  77. extern FILE     _iob[_NFILE];
  78. extern FILE     *fopen(), *fdopen(), *freopen();
  79. extern long     ftell();
  80. extern void     rewind(), setbuf();
  81. extern char     *fgets(), *gets();
  82.  
  83. #endif __STDIO__
  84.